
export default {
  trialPrice (params, callback) {
    let price = 0
    T.fetchFusion({ // 調用保费试算接口
      url: '/fusion/channel-goods/calPremium',
      data: params,
      loading: true
    }).then((res) => {
      if (res.success) {
        let detail
        if (res.value) {
          price = res.value.total
          detail = res.value.detail
        }
        callback && callback(price, detail)
      }
    })
  },
  getAdultDate (date = new Date()) {
    let year = date.getFullYear()
    let adultYear = year - 18
    date.setFullYear(adultYear)
    return date
  },
  getInitTrialFactors () {
    let factors = T.sessionStorage.get('calculateVals')
    if (factors) {
      factors = JSON.parse(factors)
    }
    factors = factors || {}
    return factors
  }
}
